package br.com.projeto.web.vraptor.interceptors;

import br.com.caelum.vraptor.InterceptionException;
import br.com.caelum.vraptor.Intercepts;
import br.com.caelum.vraptor.core.InterceptorStack;
import br.com.caelum.vraptor.interceptor.Interceptor;
import br.com.caelum.vraptor.resource.ResourceMethod;
import br.com.projeto.web.vraptor.componentes.ContentResourceBundle;

@Intercepts
public class ContentInterceptor implements Interceptor {

	private ContentResourceBundle bundle;

	public ContentInterceptor(ContentResourceBundle bundle) {
		this.bundle = bundle;
	}

	public boolean accepts(ResourceMethod method) {
		return true;
	}

	public void intercept(InterceptorStack stack, ResourceMethod method,
			Object resource) throws InterceptionException {

		this.bundle.addContentFor(method);
		stack.next(method, resource);

	}

}
